Fix #202: add a View Only toggle to the VNC session toolbar#273
Open
eran132 wants to merge 1 commit into
Open
Conversation
VNC sessions could only set View Only before connecting (favorite option); there was no way to flip it during a live session. Add a checkable "View Only" item to the VNC actions toolbar dropdown that toggles input mode on the running session. - VNCConnection.ToggleViewOnly() flips the state and calls RemoteDesktop.SetInputMode, exposing the current state via ViewOnly. The state is seeded from the favorite's VncViewOnly option on connect. - VncMenuVisitor adds the checkable menu item and keeps its checked state in sync with the current connection on each toolbar visit. Fixes Terminals-Origin#202 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a “View Only” toggle to the VNC actions toolbar menu and wires it to the active VNC session’s input mode.
Changes:
- Add “View Only” menu item to the VNC toolbar dropdown and keep its checked state in sync when switching sessions/tabs.
- Implement
VNCConnection.ViewOnly+ToggleViewOnly()and initialize fromVncOptions. - Extend UI tests to validate the new menu item and update expected menu item count.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Source/Tests/UserInterface/VncMenuVisitorTests.cs | Updates existing assertion count and adds a test ensuring the View Only toggle exists and is labeled correctly. |
| Source/Terminals.Plugins.Vnc/VncMenuVisitor.cs | Adds a View Only ToolStripMenuItem, syncs checked state from current VNCConnection, and toggles session mode on click. |
| Source/Terminals.Plugins.Vnc/VNCConnection.cs | Persists view-only state, exposes it via property, toggles it at runtime, and initializes it from options on connect. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| menuVisitor.Visit(sut.Toolbar); | ||
| int itemsCount = ((ToolStripDropDownButton)sut.Toolbar.Items[0]).DropDownItems.Count; | ||
| Assert.AreEqual(5, itemsCount, "First visit should update the menu by add its own drop donw menu items"); | ||
| Assert.AreEqual(6, itemsCount, "First visit should update the menu by add its own drop donw menu items"); |
Comment on lines
+86
to
+89
| this.viewOnlyToolStripMenuItem = new ToolStripMenuItem(); | ||
| this.viewOnlyToolStripMenuItem.Name = "viewOnlyToolStripMenuItem"; | ||
| this.viewOnlyToolStripMenuItem.Size = new Size(202, 22); | ||
| this.viewOnlyToolStripMenuItem.Text = "View Only"; |
Comment on lines
+36
to
+44
| public bool ToggleViewOnly() | ||
| { | ||
| if (rd == null) | ||
| return this.viewOnly; | ||
|
|
||
| this.viewOnly = !this.viewOnly; | ||
| rd.SetInputMode(this.viewOnly); | ||
| return this.viewOnly; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #202. "View Only" for VNC could only be set on the favorite before connecting — there was no way to toggle it during a live session (as requested in the issue, similar to UltraVNC Viewer's option toggle).
This adds a checkable View Only item to the existing VNC actions toolbar dropdown (the one that already offers Send ALT/CTRL/etc.), so it only shows for VNC sessions.
Change
VNCConnection.ToggleViewOnly()flips the live input mode viaRemoteDesktop.SetInputMode(viewOnly)and returns the new state;VNCConnection.ViewOnlyexposes the current state. The state is seeded from the favorite'sVncViewOnlyoption on connect, so the toggle starts in sync.VncMenuVisitoradds the checkable menu item and re-syncs itsCheckedstate to the current connection on each toolbar visit (so switching tabs reflects the right state).Tests
VncMenuVisitorTests: updated the dropdown item count (5 → 6) and added a test asserting the View Only toggle is present and labelled. Verified red→green (both fail before the change, pass after). Full suite shows no new failures (the only pre-existing local failures are the SQL/LocalDB tests, which need a database).🤖 Generated with Claude Code